package com.luxk.db.server;

public enum ShutdownMode {
	NONE(0, "NONE"),
	NORMAL(0, "NORMAL"),
	IMMEDIATE(1, "IMMEDIATE"),
	ABORT(2, "ABORT"),
	ABNORMAL(3, "ABNORMAL");
	
	private final int intVal;
	private final String strVal;
	
	ShutdownMode(int intVal, String strVal) {
		this.intVal = intVal;
		this.strVal = strVal;
	}
	
	public int getIntVal() { return this.intVal; }
	public String getStrVal() { return this.strVal; }
	
	public ShutdownMode getShutdownMode(int intVal) {
		for(ShutdownMode m: ShutdownMode.values()) {
			if(intVal == m.getIntVal()) return m;
		}
		return ShutdownMode.NONE;
	}
	
	public ShutdownMode getShutdownMode(String strVal) {

		for(ShutdownMode m: ShutdownMode.values()) {
			if(m.getStrVal().equalsIgnoreCase(strVal)) return m;
		}
		return ShutdownMode.NONE;
	}
}